// 云函数入口文件
const cloud = require('wx-server-sdk')
const axios = require('axios')

cloud.init()

const BASE_URL = 'http://www.zhaochong.top:9000/api'

// 云函数入口函数
exports.main = async (event, context) => {
    const wxContext = cloud.getWXContext()

    try {
        await axios.post('${BASE_URL}/user/',{
            openid:wxContext.OPENID
        })
    } catch (error) {
        console.log(error);
    }

    return {
        event,
        openid: wxContext.OPENID,
        appid: wxContext.APPID,
        unionid: wxContext.UNIONID,
    }
}